package cn.gcjxsc.entity.salesman;

import cn.gcjxsc.consts.IntegralRecordType;
import cn.gcjxsc.entity.converter.IntegralRecordTypeConverter;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * 积分流水
 */
@Entity
@Table(name = "rw_salesman_integral_record")
public class IntegralRecord {

    public IntegralRecord() {
    }

    public IntegralRecord(BigDecimal amount, Integer storeId) {
        this.amount = amount;
        this.storeId = storeId;
    }

    @Id
    @GeneratedValue
    private Integer id;
    /**
     * 所属业务员
     */
    @ManyToOne
    @JoinColumn(name = "salesman_id", referencedColumnName = "id")
    private Salesman salesman;
    /**
     * 业务员对应的会员id
     */
    private Integer memberId;
    private Long created;
    private BigDecimal amount;
    @Convert(converter = IntegralRecordTypeConverter.class)
    private IntegralRecordType type;
    private String remark;
    private String sn;
    private Integer storeId;
    /**
     * 收益比例
     */
    private BigDecimal rate;
    /**
     * 来源会员
     */
    private String source;
    /**
     * 来源金额
     */
    private BigDecimal sourceAmount;

    public Integer getMemberId() {
        return memberId;
    }

    public void setMemberId(Integer memberId) {
        this.memberId = memberId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Salesman getSalesman() {
        return salesman;
    }

    public void setSalesman(Salesman salesman) {
        this.salesman = salesman;
    }

    public Long getCreated() {
        return created;
    }

    public void setCreated(Long created) {
        this.created = created;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public IntegralRecordType getType() {
        return type;
    }

    public void setType(IntegralRecordType type) {
        this.type = type;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public BigDecimal getRate() {
        return rate;
    }

    public void setRate(BigDecimal rate) {
        this.rate = rate;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public BigDecimal getSourceAmount() {
        return sourceAmount;
    }

    public void setSourceAmount(BigDecimal sourceAmount) {
        this.sourceAmount = sourceAmount;
    }

    public Integer getStoreId() {
        return storeId;
    }

    public void setStoreId(Integer storeId) {
        this.storeId = storeId;
    }
}
